<?php
require $_SERVER['DOCUMENT_ROOT'].'/../_core/common.php';

//权限验证
if( Role::init() == false ){
	exit('没有权限');
}

require $_SERVER['DOCUMENT_ROOT'].'/../_interface/pages.php';

$db = new DB('vip');

$status_type = isset($_GET['status_type']) ? intval($_GET['status_type']) : 0;

if($status_type == 1){
	$where = ' where status=1';
	$this_address = '待审核会员列表';
}elseif($status_type == 2){
	$where = ' where status=2';
	$this_address = '已认证会员列表';
}elseif($status_type == 3){
	$where = ' where status=3';
	$this_address = '已拒绝会员列表';
}else{
	$where = ' where 1=1';
	$this_address = '会员总列表';
}
$where .= ' and rank=1';

//查询总记录数
$total_sql = 'select id from vip_to_salesman'.$where;
$total = $db->query($total_sql)->getCount();

$pageSize = 20;//每页显示条数
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
if( $page < 1 ){
	$page = 1;
}

//分页html
$page_html = Pages::page($page, $total, $pageSize, '/admin/vip/vip_lists_upgrade.php?status_type='.$status_type);

$vip_sql = 'select * from vip_to_salesman'.$where.' order by id desc limit '.(($page-1)*$pageSize).','.$pageSize;
$vip_rs = $db->query($vip_sql)->getAll();
$pagenav;

//包含模板
require template('admin/vip/vip_lists_upgrade');